﻿<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
                    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
                    mc:Ignorable="d" xmlns:System="clr-namespace:System;assembly=mscorlib">

    <!-- Border background for pop-ups-->
    <LinearGradientBrush x:Key="BorderBackgroundOuter"
                         EndPoint="0.5,1"
                         StartPoint="0.5,0">
        <GradientStop Color="#FF0A0A0A"
                      Offset="0" />
        <GradientStop Color="#FF404040"
                      Offset="0.995" />
        <GradientStop Color="#FF000000"
                      Offset="0.525" />
        <GradientStop Color="#FF000000"
                      Offset="0.723" />
        <GradientStop Color="#FF000000"
                      Offset="0.286" />
        <GradientStop Color="#FF1A1A1A"
                      Offset="0.848" />
    </LinearGradientBrush>

    <!--Glass Button-->
    <ControlTemplate x:Key="GlassButton"
                     TargetType="{x:Type Button}">
        <ControlTemplate.Resources>
            <Storyboard x:Key="ButtonMouseOverEnter">
                <DoubleAnimationUsingKeyFrames BeginTime="00:00:00"
                                               Storyboard.TargetName="Glow"
                                               Storyboard.TargetProperty="(UIElement.Opacity)">
                    <SplineDoubleKeyFrame KeyTime="00:00:00.3000000"
                                          Value="1" />
                </DoubleAnimationUsingKeyFrames>
                <ColorAnimationUsingKeyFrames BeginTime="00:00:00"
                                              Storyboard.TargetName="Glow"
                                              Storyboard.TargetProperty="(Panel.Background).(GradientBrush.GradientStops)[0].(GradientStop.Color)">
                    <SplineColorKeyFrame KeyTime="00:00:00.3000000"
                                         Value="#B28DBDFF" />
                </ColorAnimationUsingKeyFrames>
            </Storyboard>
            <Storyboard x:Key="ButtonMouseOverLeave">
                <DoubleAnimationUsingKeyFrames BeginTime="00:00:00"
                                               Storyboard.TargetName="Glow"
                                               Storyboard.TargetProperty="(UIElement.Opacity)">
                    <SplineDoubleKeyFrame KeyTime="00:00:00.3000000"
                                          Value="0" />
                </DoubleAnimationUsingKeyFrames>
            </Storyboard>
        </ControlTemplate.Resources>
        <Border Height="{TemplateBinding Height}"
                Width="{TemplateBinding Width}"
                BorderThickness="1,1,1,1"
                CornerRadius="4,4,4,4"
                Background="{x:Null}"
                BorderBrush="#FF808080">
            <Border BorderThickness="1,1,1,1"
                    CornerRadius="4,4,4,4"
                    BorderBrush="#FF000000"
                    Background="#7F000000"
                    x:Name="border">
                <Grid>
                    <Grid.RowDefinitions>
                        <RowDefinition Height="0.5*" />
                        <RowDefinition Height="0.5*" />
                    </Grid.RowDefinitions>
                    <Border Margin="0,0,0,0"
                            Grid.RowSpan="2"
                            d:LayoutOverrides="GridBox"
                            Opacity="0"
                            x:Name="Glow">
                        <Border.Background>
                            <RadialGradientBrush>
                                <RadialGradientBrush.RelativeTransform>
                                    <TransformGroup>
                                        <ScaleTransform CenterX="0.5"
                                                        CenterY="0.5"
                                                        ScaleX="1.715"
                                                        ScaleY="1.94" />
                                        <SkewTransform AngleX="0"
                                                       AngleY="0"
                                                       CenterX="0.5"
                                                       CenterY="0.5" />
                                        <RotateTransform Angle="0"
                                                         CenterX="0.5"
                                                         CenterY="0.5" />
                                        <TranslateTransform X="0.02"
                                                            Y="0.47" />
                                    </TransformGroup>
                                </RadialGradientBrush.RelativeTransform>
                                <GradientStop Color="#B28DBDFF"
                                              Offset="0" />
                                <GradientStop Color="#008DBDFF"
                                              Offset="1" />
                            </RadialGradientBrush>
                        </Border.Background>
                    </Border>
                    <ContentPresenter Margin="0,0,0,0"
                                      Grid.RowSpan="2"
                                      HorizontalAlignment="Center"
                                      VerticalAlignment="Center"
                                      x:Name="contentPresenter" />
                    <Border Margin="0,0,0,0"
                            Grid.RowSpan="1"
                            CornerRadius="4,4,0,0"
                            x:Name="GlassEffect">
                        <Border.Background>
                            <LinearGradientBrush EndPoint="0.5,1"
                                                 StartPoint="0.5,0">
                                <GradientStop Color="#99FFFFFF"
                                              Offset="0" />
                                <GradientStop Color="#33FFFFFF"
                                              Offset="1" />
                            </LinearGradientBrush>
                        </Border.Background>
                    </Border>
                </Grid>
            </Border>
        </Border>
        <ControlTemplate.Triggers>
            <Trigger Property="IsPressed"
                     Value="True">
                <Setter Property="Background"
                        TargetName="border"
                        Value="#CC000000" />
                <Setter Property="Opacity"
                        TargetName="GlassEffect"
                        Value="0.4" />
            </Trigger>
            <Trigger Property="IsEnabled"
                     Value="False">
                <Setter Property="Opacity"
                        TargetName="contentPresenter"
                        Value="0.5" />
                <Setter Property="Opacity"
                        TargetName="GlassEffect"
                        Value="0" />
                <Setter Property="Opacity"
                        TargetName="border"
                        Value="0.25" />
            </Trigger>
            <Trigger Property="IsMouseOver"
                     Value="True">
                <Trigger.ExitActions>
                    <BeginStoryboard Storyboard="{StaticResource ButtonMouseOverLeave}"
                                     x:Name="ButtonMouseOverLeave_BeginStoryboard" />
                </Trigger.ExitActions>
                <Trigger.EnterActions>
                    <BeginStoryboard Storyboard="{StaticResource ButtonMouseOverEnter}"
                                     x:Name="ButtonMouseOverEnter_BeginStoryboard" />
                </Trigger.EnterActions>
            </Trigger>
        </ControlTemplate.Triggers>
    </ControlTemplate>

    <!--Background for AddNewFeed UC-->
    <LinearGradientBrush x:Key="AddNewFeedBackgroundBrush"
                         EndPoint="0.5,1"
                         StartPoint="0.5,0">
        <GradientStop Color="#FF616161"
                      Offset="0" />
        <GradientStop Color="#FF404040"
                      Offset="0.995" />
        <GradientStop Color="#FF707070"
                      Offset="0.525" />
        <GradientStop Color="#FF5D5D5D"
                      Offset="0.723" />
        <GradientStop Color="#FF5A5A5A"
                      Offset="0.286" />
        <GradientStop Color="#FF404040"
                      Offset="0.848" />
    </LinearGradientBrush>

    <!--Background for feeds ListBox-->
    <SolidColorBrush x:Key="FeedViewItemsBackground"
                     Color="#E5000000" />

    <!--Panel template for ListBox-->
    <ItemsPanelTemplate x:Key="FeedViewItemTemplate">
        <VirtualizingStackPanel IsItemsHost="True"
                                Background="{DynamicResource FeedViewItemsBackground}" />
    </ItemsPanelTemplate>

    <!--ListBoxItemStyle for feeds-->
    <Style x:Key="FeedItemStyle"
           TargetType="{x:Type ListBoxItem}">
        <!-- 
            Bind the IsSelected property of a ListViewItem to the 
            IsSelected property of a CustomerViewModel object.
            -->
        <Setter Property="IsSelected"
                Value="{Binding IsSelected, Mode=TwoWay}" />

        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type ListBoxItem}">
                    <Border x:Name="ItemBorder"
                            Margin="6,3,6,3"
                            CornerRadius="5,5,5,5"
                            BorderThickness="1,1,1,1"
                            BorderBrush="#FFFFFFFF">
                        <ContentPresenter />
                    </Border>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsSelected"
                                 Value="true">
                            <Setter TargetName="ItemBorder"
                                    Property="BitmapEffect">
                                <Setter.Value>
                                    <OuterGlowBitmapEffect GlowColor="White"
                                                           GlowSize="8" />
                                </Setter.Value>
                            </Setter>
                            <Setter Property="Background"
                                    TargetName="ItemBorder"
                                    Value="{DynamicResource AddNewFeedBackgroundBrush}" />
                            <Setter Property="BorderBrush"
                                    TargetName="ItemBorder">
                                <Setter.Value>
                                    <LinearGradientBrush EndPoint="0.5,1"
                                                         StartPoint="0.5,0">
                                        <GradientStop Color="#FF7AA9E5"
                                                      Offset="0" />
                                        <GradientStop Color="#FFB2C7E1"
                                                      Offset="1" />
                                        <GradientStop Color="#FF6194D6"
                                                      Offset="0.576" />
                                    </LinearGradientBrush>
                                </Setter.Value>
                            </Setter>
                            <Setter Property="BorderThickness"
                                    TargetName="ItemBorder"
                                    Value="4,4,4,4" />
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <!--TreeViewItem styling-->
    <Style x:Key="TreeViewItemFocusVisual">
        <Setter Property="Control.Template">
            <Setter.Value>
                <ControlTemplate>
                    <Rectangle />
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
    <PathGeometry x:Key="TreeArrow"
                  Figures="M0,0 L0,6 L6,0 z" />
    <Style x:Key="ExpandCollapseToggleStyle"
           TargetType="{x:Type ToggleButton}">
        <Setter Property="Focusable"
                Value="False" />
        <Setter Property="Width"
                Value="16" />
        <Setter Property="Height"
                Value="16" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type ToggleButton}">
                    <Border Width="16"
                            Height="16"
                            Background="Transparent"
                            Padding="5,5,5,5">
                        <Path x:Name="ExpandPath"
                              Fill="Transparent"
                              Stroke="#FF989898"
                              Data="{StaticResource TreeArrow}">
                            <Path.RenderTransform>
                                <RotateTransform Angle="135"
                                                 CenterX="3"
                                                 CenterY="3" />
                            </Path.RenderTransform>
                        </Path>
                    </Border>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsMouseOver"
                                 Value="True">
                            <Setter Property="Stroke"
                                    TargetName="ExpandPath"
                                    Value="#FF1BBBFA" />
                            <Setter Property="Fill"
                                    TargetName="ExpandPath"
                                    Value="Transparent" />
                        </Trigger>
                        <Trigger Property="IsChecked"
                                 Value="True">
                            <Setter Property="RenderTransform"
                                    TargetName="ExpandPath">
                                <Setter.Value>
                                    <RotateTransform Angle="180"
                                                     CenterX="3"
                                                     CenterY="3" />
                                </Setter.Value>
                            </Setter>
                            <Setter Property="Fill"
                                    TargetName="ExpandPath"
                                    Value="#FF595959" />
                            <Setter Property="Stroke"
                                    TargetName="ExpandPath"
                                    Value="#FF262626" />
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
    <LinearGradientBrush x:Key="TrewViewItemSelected"
                         EndPoint="0.5,1"
                         StartPoint="0.5,0">
        <GradientStop Color="#FFF3E37F"
                      Offset="0" />
        <GradientStop Color="#FFFFE226"
                      Offset="1" />
    </LinearGradientBrush>
	<System:Double x:Key="BorderOuterOpacity">0.85</System:Double>
	<Thickness x:Key="BorderInnerThickness">1</Thickness>
    <LinearGradientBrush x:Key="TreeViewItemSelectedGlass"
                         EndPoint="0.5,1"
                         StartPoint="0.5,0">
        <GradientStop Color="#CCFFFFFF"
                      Offset="0" />
        <GradientStop Color="#00FFFFFF"
                      Offset="1" />
    </LinearGradientBrush>
    <LinearGradientBrush x:Key="BorderBackgroundInner" EndPoint="0.5,1"
    	StartPoint="0.5,0">
    	<GradientStop Color="#4CFFFFFF"
    		Offset="0" />
    	<GradientStop Color="#00FFFFFF"
    		Offset="1" />
    </LinearGradientBrush>
    <LinearGradientBrush x:Key="TextBoxBorderBrush" EndPoint="0,20"
    	StartPoint="0,0"
    	MappingMode="Absolute">
    	<GradientStop Color="#FFDBD79F"
    		Offset="0" />
    	<GradientStop Color="#FF168BFF"
    		Offset="1" />
    </LinearGradientBrush>
    <SolidColorBrush x:Key="TextBoxbackground" Color="Black"/>
    <Style x:Key="TreeViewItemStyle"
           TargetType="{x:Type TreeViewItem}">
        <Setter Property="Background"
                Value="Transparent" />
        <Setter Property="HorizontalContentAlignment"
                Value="{Binding HorizontalContentAlignment, RelativeSource={RelativeSource AncestorType={x:Type ItemsControl}}}" />
        <Setter Property="VerticalContentAlignment"
                Value="{Binding VerticalContentAlignment, RelativeSource={RelativeSource AncestorType={x:Type ItemsControl}}}" />
        <Setter Property="Padding"
                Value="1,0,0,0" />
        <Setter Property="Foreground"
                Value="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}" />
        <Setter Property="FocusVisualStyle"
                Value="{StaticResource TreeViewItemFocusVisual}" />
        <Setter Property="IsSelected"
                Value="{Binding IsSelected, Mode=TwoWay}" />
        <Setter Property="IsExpanded"
                Value="{Binding IsExpanded, Mode=TwoWay}" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type TreeViewItem}">
                    <ControlTemplate.Resources>
                        <Storyboard x:Key="TreeViewItemMouseOver">
                            <ColorAnimationUsingKeyFrames BeginTime="00:00:00"
                                                          Storyboard.TargetName="Bd"
                                                          Storyboard.TargetProperty="(Panel.Background).(GradientBrush.GradientStops)[0].(GradientStop.Color)">
                                <SplineColorKeyFrame KeyTime="00:00:00"
                                                     Value="#00FFFFFF" />
                                <SplineColorKeyFrame KeyTime="00:00:00.8000000"
                                                     Value="#CCFFFFFF" />
                            </ColorAnimationUsingKeyFrames>
                            <ColorAnimationUsingKeyFrames BeginTime="00:00:00"
                                                          Storyboard.TargetName="border"
                                                          Storyboard.TargetProperty="(Panel.Background).(GradientBrush.GradientStops)[0].(GradientStop.Color)">
                                <SplineColorKeyFrame KeyTime="00:00:00"
                                                     Value="#00F3E37F" />
                                <SplineColorKeyFrame KeyTime="00:00:00.4000000"
                                                     Value="#FFF3E37F" />
                            </ColorAnimationUsingKeyFrames>
                            <ColorAnimationUsingKeyFrames BeginTime="00:00:00"
                                                          Storyboard.TargetName="border"
                                                          Storyboard.TargetProperty="(Panel.Background).(GradientBrush.GradientStops)[1].(GradientStop.Color)">
                                <SplineColorKeyFrame KeyTime="00:00:00"
                                                     Value="#00FFE226" />
                                <SplineColorKeyFrame KeyTime="00:00:00.4000000"
                                                     Value="#FFFFE226" />
                            </ColorAnimationUsingKeyFrames>
                        </Storyboard>
                    </ControlTemplate.Resources>
                    <Grid x:Name="grid">
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition MinWidth="19"
                                              Width="Auto" />
                            <ColumnDefinition Width="Auto" />
                            <ColumnDefinition Width="*" />
                        </Grid.ColumnDefinitions>
                        <Grid.RowDefinitions>
                            <RowDefinition Height="Auto" />
                            <RowDefinition />
                        </Grid.RowDefinitions>
                        <ToggleButton x:Name="Expander"
                                      Style="{StaticResource ExpandCollapseToggleStyle}"
                                      ClickMode="Press"
                                      IsChecked="{Binding IsExpanded, RelativeSource={RelativeSource TemplatedParent}}"
                                      Cursor="Hand" />
                        <Border x:Name="border"
                                Grid.Column="1"
                                CornerRadius="3,3,3,3">
                            <Border.Background>
                                <LinearGradientBrush EndPoint="0.5,1"
                                                     StartPoint="0.5,0">
                                    <GradientStop Color="#00F3E37F"
                                                  Offset="0" />
                                    <GradientStop Color="#00FFE226"
                                                  Offset="1" />
                                </LinearGradientBrush>
                            </Border.Background>
                            <Border x:Name="Bd"
                                    SnapsToDevicePixels="true"
                                    BorderBrush="{TemplateBinding BorderBrush}"
                                    BorderThickness="{TemplateBinding BorderThickness}"
                                    CornerRadius="3,3,3,3"
                                    Padding="3,1,3,1">
                                <Border.Background>
                                    <LinearGradientBrush EndPoint="0.5,1"
                                                         StartPoint="0.5,0">
                                        <GradientStop Color="#00FFFFFF"
                                                      Offset="0" />
                                        <GradientStop Color="#00FFFFFF"
                                                      Offset="1" />
                                    </LinearGradientBrush>
                                </Border.Background>
                                <ContentPresenter x:Name="PART_Header"
                                                  SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"
                                                  ContentSource="Header" />
                            </Border>
                        </Border>
                        <ItemsPresenter x:Name="ItemsHost"
                                        Grid.Column="1"
                                        Grid.ColumnSpan="2"
                                        Grid.Row="1" />
                    </Grid>
                    <ControlTemplate.Triggers>
                        <MultiTrigger>
                            <MultiTrigger.Conditions>
                                <Condition Property="IsMouseOver"
                                           SourceName="border"
                                           Value="True" />
                                <Condition Property="IsSelected"
                                           Value="False" />
                            </MultiTrigger.Conditions>
                            <MultiTrigger.ExitActions>
                                <RemoveStoryboard BeginStoryboardName="TreeViewItemMouseOver_BeginStoryboard" />
                            </MultiTrigger.ExitActions>
                            <MultiTrigger.EnterActions>
                                <BeginStoryboard x:Name="TreeViewItemMouseOver_BeginStoryboard"
                                                 Storyboard="{StaticResource TreeViewItemMouseOver}" />
                            </MultiTrigger.EnterActions>
                        </MultiTrigger>
                        <Trigger Property="IsSelected"
                                 Value="True">
                            <Setter Property="Background"
                                    TargetName="border"
                                    Value="{DynamicResource TrewViewItemSelected}" />
                            <Setter Property="Background"
                                    TargetName="Bd"
                                    Value="{DynamicResource TreeViewItemSelectedGlass}" />
                        </Trigger>
                        <Trigger Property="IsExpanded"
                                 Value="false">
                            <Setter Property="Visibility"
                                    TargetName="ItemsHost"
                                    Value="Collapsed" />
                        </Trigger>
                        <Trigger Property="HasItems"
                                 Value="false">
                            <Setter Property="Visibility"
                                    TargetName="Expander"
                                    Value="Hidden" />
                        </Trigger>
                        <Trigger Property="IsEnabled"
                                 Value="false">
                            <Setter Property="Foreground"
                                    Value="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}" />
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
    <SolidColorBrush x:Key="WhiteForeground" Color="White"/>

</ResourceDictionary>